package com.corffen.design.builder;

public class AlertDialog {

    private AlertController mAlertController;

    public AlertDialog() {
        mAlertController = new AlertController();
    }

    public void setTitle(String title) {
        mAlertController.setTitle(title);
    }

    public void setMessage(String msg) {
        mAlertController.setMessage(msg);
    }

    public String getTitle() {
        return mAlertController.getTitle();
    }

    public String getMessage() {
        return mAlertController.getMessage();
    }

    public void show(){
        System.out.println("AlertDialog{" +
                "title=" + getTitle() + ",message=" + getMessage() +
                '}');
    }


    public static class Builder {
        AlertController.Params mParams;

        public Builder() {
            mParams = new AlertController.Params();
        }

        public Builder setMessage(String msg) {
            mParams.message = msg;
            return this;
        }

        public Builder setTitle(String title) {
            mParams.title = title;
            return this;
        }

        public AlertDialog create() {
            AlertDialog dialog = new AlertDialog();
            mParams.apply(dialog.mAlertController);
            return dialog;
        }
    }
}
